package com.mall.shiro;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;

public class CredentialMatcher extends SimpleCredentialsMatcher{
	//校验密码
	@Override
	public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
		System.out.println("*************校验密码***************");
		// TODO Auto-generated method stub
		UsernamePasswordToken usernamePasswordToken=(UsernamePasswordToken) token;
		String password=new String(usernamePasswordToken.getPassword());
		String dbPassword=(String) info.getCredentials();
		return this.equals(password, dbPassword);
	}
}
